package com.he.heblog.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.he.heblog.entity.validInterface.addValid;
import com.he.heblog.entity.validInterface.editValid;
import com.he.heblog.entity.validInterface.sendMsg;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;

/**
 * <p>
 * 
 * </p>
 *
 * @author 余生
 * @since 2023-03-27
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User implements Serializable {

    private static final long serialVersionUID = 1L;
    @NotNull(groups = {editValid.class},message = "编辑时必须指定ID")
    @Null(groups = {addValid.class},message = "新增用户时不能指定ID")
    private Integer id;
    @NotBlank(groups = {addValid.class,editValid.class})
    private String username;
    @NotBlank(groups = {addValid.class,editValid.class})
    @TableField("`password`")
    private String password;
    @NotBlank(groups = {addValid.class,editValid.class, sendMsg.class})
    @Email(groups = {addValid.class,editValid.class, sendMsg.class})
    private String email;

    private String phone;

    /**
     * 头像
     */
    private String avatar;

    private Integer gender;

    /**
     * 用户自我介绍
     */
    private String introduce;

}
